import FormItemProps,{ type IFormItemProps } from './FormItemProps';

export interface IFieldProps extends IFormItemProps{
  field_code?: string
  field_label?: string
  field_value?: string
  field_default?: string
  field_format?: string
}
export default class FieldProps extends FormItemProps implements IFieldProps{

  public field_code = "";
  public field_label = "";
  public field_value = "";
  public field_default = "";
  public field_format = "";

  constructor(props?:IFieldProps) {
    super(props);
    if(props){
      this.field_code = props.field_code || `FIELD_${this.widgetId.substring(this.widgetId.indexOf('_')+1)}` || this.field_code;
      this.field_label = props.field_label || props.widgetLabel || this.field_label;
      this.field_value = props.field_value || this.field_value;
      this.field_default = props.field_default || this.field_default;
      this.field_format = props.field_format || this.field_format;
    }
  }
}